//登录状态
var headmode = {
  "loginMark": "", //登录标记
  "reqDigest": "",
  "category": "3", //微信统一进入传递参数为3
  "imei": "",
  "imsi": "",
  "phonetype": "",
  "timestamp": "1502951724089",
  "version": "2.0.1"
}
//获取区划信息
wx.request({
  method: 'GET',
  url: '' + getApp().globalData.wxurl +'/allreq/administrative/divisioncode/51',
  header: {
    "Content-Type": "application/x-www-form-urlencoded",
    "headMode": JSON.stringify(headmode),
  }, 
  success: function (c) {
    console.log(c)
    var temp = c.data;
    wx.setStorage({ key: "temp", data: JSON.stringify(temp) })
  },
  fail: function (f) {
    console.log(f)
  },
});

var cityDatas = JSON.parse(wx.getStorageSync('temp')); 
//需求格式组装
var cityData = [
  {
    "divisionName": "四川省",
    "divisionCode": "51",
    "divisionId":"00000000000000000000000000000001",
    "children": cityDatas
  }
]

function init(that) {
  that.setData({
    'cityData': cityData
  });
}

module.exports = {
  init: init
}